home *** CD-ROM | disk | FTP | other *** search
/ BBS Toolkit / BBS Toolkit.iso / wildcat / digikit.zip / APDIGI.PAS next >
Pascal/Delphi Source File  |  1992-07-16  |  19KB  |  756 lines

  1. {$S-,R-,V-,I-,B-,F+,O+,A-,D+,L+}
  2.  
  3. {$I APDEFINE.INC}
  4.  
  5. {*********************************************************}
  6. {*                   APDIGI.PAS 1.04                     *}
  7. {*         Copyright (c) Mustang Software 1992.          *}
  8. {*                 All rights reserved.                  *}
  9. {*********************************************************}
  10.  
  11. unit ApDigi;
  12.  
  13. interface
  14.  
  15. uses
  16.   Dos,
  17.   {$IFDEF UseOpro}
  18.   OpInline,
  19.   OpRoot,
  20.   {$ENDIF}
  21.   {$IFDEF UseTpro}
  22.   TpCrt,
  23.   TpInline,
  24.   TpMemChk,
  25.   {$ENDIF}
  26.   ApMisc,
  27.   ApPort;
  28.  
  29.  
  30. {#Z+}
  31. procedure dInitPort(var P : PortRecPtr; ComName : ComNameType;
  32.                     Baud : LongInt;
  33.                     Parity : ParityType; DataBits : DataBitType;
  34.                     StopBits : StopBitType;
  35.                     InSize, OutSize : Word;
  36.                     Options : Word);
  37.   {-Open digi port}
  38.  
  39. procedure dInitPortKeep(var P : PortRecPtr; ComName : ComNameType;
  40.                     InSize, OutSize : Word);
  41.   {-Open digi port (without changing line params)}
  42.  
  43. procedure dDonePort(var P : PortRecPtr);
  44.   {-Closes digi port ComName}
  45.  
  46. procedure dSetUart(ComName : ComNameType; NewBase : Word;
  47.                    NewIrq, NewVector : Byte);
  48.   {-Dummy routine required by high-level routines}
  49.  
  50. procedure dSetLine(P : PortRecPtr; Baud : LongInt; Parity : ParityType;
  51.                    DataBits : DataBitType; StopBits : StopBitType);
  52.   {-Sets the digi and the port record with the new values}
  53.  
  54. procedure dGetLine(P : PortRecPtr; var Baud : LongInt;
  55.                    var Parity : ParityType;
  56.                    var DataBits : DataBitType;
  57.                    var StopBits : StopBitType;
  58.                    FromHardware : Boolean);
  59.   {-Gets the line params directly from the digi}
  60.  
  61. procedure dSetModem(P : PortRecPtr; DTR, RTS : Boolean);
  62.   {-Sets the port record with the new values}
  63.  
  64. procedure dGetModem(P : PortRecPtr; var DTR, RTS : Boolean);
  65.   {-Gets the DTR,RTS settings directly from the digi}
  66.  
  67. procedure dGetChar(P : PortRecPtr; var C : Char);
  68.   {-Returns C (sets error if none available)}
  69.  
  70. procedure dPeekChar(P : PortRecPtr; var C : Char; PeekAhead : Word);
  71.   {-Looks ahead PeekAhead chars (with 1 being the next character)}
  72.  
  73. procedure dPutChar(P : PortRecPtr; C : Char);
  74.   {-Adds char to xmit buffer or outputs in directly}
  75.  
  76. procedure dStartTransmitter(P : PortRecPtr);
  77.   {-Does nothing (but required by some high-level routines)}
  78.  
  79. function dCharReady(P : PortRecPtr) : Boolean;
  80.   {-Returns True if digi status call shows a character waiting}
  81.  
  82. function dTransReady(P : PortRecPtr) : Boolean;
  83.   {-Returns True if digi status call shows room in output buffer}
  84.  
  85. function dGetLineStatusDirect(P : PortRecPtr) : Byte;
  86.  
  87. procedure dSendBreak(P : PortRecPtr);
  88.   {-Sends a serial line break}
  89.  
  90. procedure dActivatePort(P : PortRecPtr; Restore : Boolean);
  91.   {-Initializes the digi port}
  92.  
  93. procedure dDeactivatePort(P : PortRecPtr; Restore : Boolean);
  94.   {-Deactivates the digi port}
  95.  
  96. procedure dSavePort(P : PortRecPtr; var PSR);
  97.   {-Does nothing }
  98.  
  99. procedure dRestorePort(P : PortRecPtr; var PSR);
  100.   {-Does nothing }
  101.  
  102. procedure dGotError(P : PortRecPtr; StatusCode : Word);
  103.   {-Called when an error occurs (GotError calls the optional ErrorHandler)}
  104. {#Z-}
  105.  
  106. procedure ActivateApDigi;
  107.   {-Registers this unit as the active "device layer"}
  108.  
  109. implementation
  110.  
  111. const
  112.   ecCCBTimeOut  = 9980;  {DigiChannel driver timed out on CCB command}
  113.  
  114. type
  115.   BytePtr = ^Byte;
  116.   OS = record
  117.          O : Word;
  118.          S : Word;
  119.        end;
  120.  
  121. var
  122.   CharReadyPtr : BytePtr;
  123.  
  124.  
  125.   procedure dInitPortKeep(var P : PortRecPtr; ComName : ComNameType;
  126.                           InSize, OutSize : Word);
  127.   var
  128.     Found : Boolean;
  129.     I : Byte;
  130.     PWord : Word;
  131.     DTR, RTS : Boolean;
  132.  
  133.   label
  134.     ErrorExit;
  135.  
  136.   begin
  137.     AsyncStatus := ecOk;
  138.  
  139.     if not GetMemCheck(P, SizeOf(PortRec)) then
  140.       begin
  141.         AsyncStatus := ecOutOfMemory;
  142.         Exit;
  143.       end;
  144.  
  145.     {$IFDEF LargeComNameSet}
  146.     if ComName > Com8 then
  147.       begin
  148.         AsyncStatus := ecOutOfRange;
  149.         goto ErrorExit;
  150.       end;
  151.     {$ENDIF}
  152.  
  153.     with P^ do
  154.       begin
  155.         PortName := ComName;
  156.  
  157.         Found := False;
  158.         I := 1;
  159.         while not Found and (I <= MaxActivePort) do
  160.           if ActiveComPort[I] = nil then
  161.             begin
  162.               CurrentPort := I;
  163.               ActiveComPort[I] := P;
  164.               Found := True;
  165.             end
  166.           else
  167.             Inc(I);
  168.  
  169.         if not Found then
  170.           begin
  171.             AsyncStatus := ecNoMorePorts;
  172.             goto ErrorExit;
  173.           end;
  174.  
  175.         SWFState := False;
  176.         SWFGotXoff := False;
  177.         SWFSentXoff := False;
  178.         SWFOnChar := DefaultXonChar;
  179.         SWFOffChar := DefaultXoffChar;
  180.  
  181.         HWFRecHonor := 0;
  182.         HWFTransHonor := 0;
  183.         HWFRemoteOff := False;
  184.         LastXmitError := 0;
  185.  
  186.         Buffered := False;
  187.         InBuff := nil;
  188.         InHead := nil;
  189.         InTail := nil;
  190.         InBuffEnd := nil;
  191.         InBuffLen := 65535;
  192.         InBuffCount := 0;
  193.         OutBuff := nil;
  194.         OutHead := nil;
  195.         OutTail := nil;
  196.         OutBuffEnd := nil;
  197.         OutBuffLen := 65535;
  198.         OutBuffCount := 0;
  199.  
  200.         UseStatusBuffer := False;
  201.         StatBuff := nil;
  202.         StatHead := nil;
  203.         StatTail := nil;
  204.  
  205.         Flags := DefPortOptions;
  206.         BreakReceived := False;
  207.         TxReady := True;
  208.         TxInts := True;
  209.         TxIntsActive := False;
  210.         LostCharCount := 0;
  211.         DoneProc := dDonePort;
  212.         ErrorProc := NoErrorProc;
  213.         ErrorData := nil;
  214.         UserAbort := NoAbortProc;
  215.         ProtocolActive := False;
  216.         ISRActive := False;
  217.  
  218.         dGetLine(P, CurBaud, CurParity, CurDataBits, CurStopBits, True);
  219.         dGetModem(P, DTR, RTS);
  220.  
  221.         PWord := Word(P^.PortName);
  222.         asm
  223.           mov ah,$1E                        {turn CTR/RTS on}
  224.           mov bh,$00
  225.           mov bl,$12
  226.           mov dx,PWord
  227.           int $14
  228.  
  229.           mov ah,$0D                        {get char ready ptr}
  230.           mov dx,PWord
  231.           int $14
  232.           mov word ptr CharReadyPtr,bx
  233.           mov word ptr CharReadyPtr+2,es
  234.  
  235.           mov ah,$09                        {flush buffers, necessary to kick char ready flag}
  236.           mov dx,PWord                      {on some Digicards, and to get full transmit buffer}
  237.           int $14                           {space in next call}
  238.  
  239.           mov ah,$12                        {get transmit buffer size}
  240.           mov dx,PWord
  241.           int $14
  242.           inc ax
  243.           les di,P
  244.           les di,es:[di]
  245.           mov es:[di].PortRec.OutBuffLen,ax
  246.         end;
  247.         Exit;
  248.       end;
  249.   ErrorExit:
  250.     FreeMemCheck(P, SizeOf(PortRec));
  251.   end;
  252.  
  253.  
  254.   procedure dInitPort(var P : PortRecPtr; ComName : ComNameType;
  255.                       Baud : LongInt;
  256.                       Parity : ParityType; DataBits : DataBitType;
  257.                       StopBits : StopBitType; InSize, OutSize : Word;
  258.                       Options : Word);
  259.   var
  260.     B : Boolean;
  261.  
  262.   begin
  263.     dInitPortKeep(P, ComName, InSize, OutSize);
  264.     if AsyncStatus <> ecOk then
  265.       Exit;
  266.     with P^ do
  267.       begin
  268.         dSetLine(P, Baud, Parity, DataBits, StopBits);
  269.         if AsyncStatus <> ecOk then
  270.           begin
  271.             ActiveComPort[CurrentPort] := nil;
  272.             FreeMemCheck(P, SizeOf(PortRec));
  273.             Exit;
  274.           end;
  275.         Flags := Options;
  276.         B := FlagIsSet(Flags, ptRaiseModemOnOpen);
  277.         if B then
  278.           ModemControl := ModemControl or (DTRMask or RTSMask);
  279.       end;
  280.     dSetModem(P, B, B);
  281.   end;
  282.  
  283.  
  284.   procedure dDonePort(var P : PortRecPtr);
  285.   begin
  286.     AsyncStatus := ecOk;
  287.     if P = nil then
  288.       Exit;
  289.     with P^ do
  290.       ActiveComPort[CurrentPort] := Nil;
  291.     FreeMemCheck(P, SizeOf(PortRec));
  292.     P := nil;
  293.   end;
  294.  
  295.  
  296.   procedure dSetUart(ComName : ComNameType; NewBase : Word; NewIrq, NewVector : Byte);
  297.   begin
  298.   end;
  299.  
  300.  
  301.   procedure dSetLine(P : PortRecPtr; Baud : LongInt;
  302.                      Parity : ParityType; DataBits : DataBitType;
  303.                      StopBits : StopBitType);
  304.   var
  305.     ParityB, StopBitsB, DataBitsB, BaudB : Byte;
  306.  
  307.   begin
  308.     AsyncStatus := ecOk;
  309.     with P^ do
  310.       begin
  311.         case Parity of
  312.           NoParity   : ParityB := 0;
  313.           OddParity  : ParityB := 1;
  314.           EvenParity : ParityB := 2;
  315.         else
  316.           dGotError(P, epFatal+ecInvalidParity);
  317.           Exit;
  318.         end;
  319.         case StopBits of
  320.           1 : StopBitsB := 0;
  321.           2 : StopBitsB := 1;
  322.         else
  323.           dGotError(P, epFatal+ecOutOfRange);
  324.           Exit;
  325.         end;
  326.         case DataBits of
  327.           5 : DataBitsB := 0;
  328.           6 : DataBitsB := 1;
  329.           7 : DataBitsB := 2;
  330.           8 : DataBitsB := 3;
  331.         else
  332.           dGotError(P, epFatal+ecOutOfRange);
  333.           Exit;
  334.         end;
  335.         if Baud > 57600 then
  336.           begin
  337.             if Baud = 76800 then
  338.               BaudB := $0B
  339.             else if Baud = 115200 then
  340.               BaudB := $0C
  341.             else
  342.               begin
  343.                 dGotError(P, epFatal+ecInvalidBaudRate);
  344.                 Exit;
  345.               end;
  346.           end
  347.         else
  348.           case Word(Baud) of
  349.             50    : BaudB := $0D;
  350.             75    : BaudB := $0E;
  351.             110   : BaudB := $00;
  352.             134   : BaudB := $0F;
  353.             150   : BaudB := $01;
  354.             200   : BaudB := $10;
  355.             300   : BaudB := $02;
  356.             600   : BaudB := $03;
  357.             1200  : BaudB := $04;
  358.             1800  : BaudB := $11;
  359.             2400  : BaudB := $05;
  360.             4800  : BaudB := $06;
  361.             9600  : BaudB := $07;
  362.             19200 : BaudB := $08;
  363.             38400 : BaudB := $09;
  364.             57600 : BaudB := $0A;
  365.           else
  366.             dGotError(P, epFatal+ecInvalidBaudRate);
  367.             Exit;
  368.           end;
  369.         asm
  370.           les di,P
  371.           mov dl,es:[di].PortRec.PortName
  372.           xor dh,dh
  373.           mov ah,$04
  374.           mov al,$00
  375.           mov bh,ParityB
  376.           mov bl,StopBitsB
  377.           mov ch,DataBitsB
  378.           mov cl,BaudB
  379.           int $14
  380.           les di,P
  381.           mov es:[di].PortRec.ModemStatus,al
  382.           mov es:[di].PortRec.LineStatus,ah
  383.         end;
  384.         CurBaud := Baud;
  385.         CurParity := Parity;
  386.         CurDataBits := DataBits;
  387.         CurStopBits := StopBits;
  388.       end;
  389.   end;
  390.  
  391.  
  392.   procedure dGetLine(P : PortRecPtr; var Baud : LongInt;
  393.                      var Parity : ParityType;
  394.                      var DataBits : DataBitType;
  395.                      var StopBits : StopBitType;
  396.                      FromHardware : Boolean);
  397.   var
  398.     ParityB, StopB, DataB, BaudB : Byte;
  399.  
  400.   begin
  401.     AsyncStatus := ecOk;
  402.     with P^ do
  403.       if not FromHardware then
  404.         begin
  405.           Baud := CurBaud;
  406.           Parity := CurParity;
  407.           DataBits := CurDataBits;
  408.           StopBits := CurStopBits;
  409.         end
  410.       else
  411.         begin
  412.           asm
  413.             les di,P
  414.             mov dl,es:[di].PortRec.PortName
  415.             xor dh,dh
  416.             mov ah,$0C
  417.             int $14
  418.             mov ParityB,bh
  419.             mov StopB,bl
  420.             mov DataB,ch
  421.             mov BaudB,cl
  422.           end;
  423.           case ParityB of
  424.             $00 : Parity := NoParity;
  425.             $01 : Parity := OddParity;
  426.             $02 : Parity := EvenParity;
  427.           end;
  428.           case StopB of
  429.             $00 : StopBits := 1;
  430.             $01 : StopBits := 2;
  431.           end;
  432.           case DataB of
  433.             $00 : DataBits := 5;
  434.             $01 : DataBits := 6;
  435.             $02 : DataBits := 7;
  436.             $03 : DataBits := 8;
  437.           end;
  438.           case BaudB of
  439.             $00 : Baud := 110;
  440.             $01 : Baud := 150;
  441.             $02 : Baud := 300;
  442.             $03 : Baud := 600;
  443.             $04 : Baud := 1200;
  444.             $05 : Baud := 2400;
  445.             $06 : Baud := 4800;
  446.             $07 : Baud := 9600;
  447.             $08 : Baud := 19200;
  448.             $09 : Baud := 38400;
  449.             $0A : Baud := 57600;
  450.             $0B : Baud := 76800;
  451.             $0C : Baud := 115200;
  452.             $0D : Baud := 50;
  453.             $0E : Baud := 75;
  454.             $0F : Baud := 134;
  455.             $10 : Baud := 200;
  456.             $11 : Baud := 1800;
  457.           end;
  458.           CurBaud := Baud;
  459.           CurParity := Parity;
  460.           CurDataBits := DataBits;
  461.           CurStopBits := StopBits;
  462.         end;
  463.   end;
  464.  
  465.  
  466.   procedure dSetModem(P : PortRecPtr; DTR, RTS : Boolean); assembler;
  467.   asm
  468.     mov AsyncStatus,ecOk
  469.     les di,P
  470.     mov dl,es:[di].PortRec.PortName
  471.     xor dh,dh
  472.     mov ah,$05
  473.     mov al,$01
  474.     mov bl,0
  475.     cmp Dtr,0
  476.     je @1
  477.     or bl,DtrMask
  478.   @1:
  479.     cmp Rts,0
  480.     je @2
  481.     or bl,RtsMask
  482.   @2:
  483.     int $14
  484.   end;
  485.  
  486.  
  487.   procedure dGetModem(P : PortRecPtr; var DTR, RTS : Boolean); assembler;
  488.   asm
  489.     mov AsyncStatus,ecOk
  490.     les di,P
  491.     mov dl,es:[di].PortRec.PortName
  492.     xor dh,dh
  493.     mov ah,$05
  494.     mov al,$00
  495.     int $14
  496.     les di,P
  497.     mov es:[di].PortRec.LineStatus,ah
  498.     mov es:[di].PortRec.ModemStatus,al
  499.     mov es:[di].PortRec.ModemControl,bl
  500.     mov al,bl
  501.     and al,DtrMask
  502.     cmp al,DtrMask
  503.     mov al,0
  504.     jne @1
  505.     inc al
  506.   @1:
  507.     les di,Dtr
  508.     mov es:[di],al
  509.     mov al,bl
  510.     and al,RtsMask
  511.     cmp al,RtsMask
  512.     mov al,0
  513.     jne @2
  514.     inc al
  515.   @2:
  516.     les di,Rts
  517.     mov es:[di],al
  518.   end;
  519.  
  520.  
  521.   procedure dGetChar(P : PortRecPtr; var C : Char);
  522.   label
  523.     GotError;
  524.  
  525.   begin
  526.     if dCharReady(P) then
  527.       begin
  528.         asm
  529.           les di,P
  530.           mov dl,es:[di].PortRec.PortName
  531.           xor dh,dh
  532.           mov ah,$02
  533.           int $14
  534.           cmp ah,$80
  535.           je GotError
  536.           les di,C
  537.           mov byte ptr es:di,al
  538.           les di,P
  539.           mov es:[di].PortRec.LineStatus,ah
  540.         end;
  541.         with P^ do
  542.           begin
  543.             if LineStatus and OverrunErrorMask = OverrunErrorMask then
  544.               AsyncStatus := ecOverrunError
  545.             else if LineStatus and ParityErrorMask = ParityErrorMask then
  546.               AsyncStatus := ecParityError
  547.             else if LineStatus and FramingErrorMask = FramingErrorMask then
  548.               AsyncStatus := ecFramingError
  549.             else
  550.               AsyncStatus := ecOk;
  551.             if AsyncStatus <> ecOk then
  552.               begin
  553.                 LineStatus := LineStatus and not (OverrunErrorMask or ParityErrorMask or FramingErrorMask);
  554.                 dGotError(P, epNonFatal+AsyncStatus);
  555.               end;
  556.           end;
  557.         {$IFDEF Tracing}
  558.         if TracingOn then
  559.           AddTraceEntry('R', C);
  560.         {$ENDIF}
  561.         Exit;
  562.       GotError:
  563.         C := #$FF;
  564.         dGotError(P, epNonFatal+ecTimeout);
  565.       end
  566.     else
  567.       dGotError(P, epNonFatal+ecBufferIsEmpty);
  568.   end;
  569.  
  570.  
  571.   procedure dPeekChar(P : PortRecPtr; var C : Char; PeekAhead : Word);
  572.   label
  573.     GotError;
  574.  
  575.   begin
  576.     if PeekAhead > 1 then
  577.       begin
  578.         dGotError(P, epNonFatal+ecInvalidArgument);
  579.         Exit;
  580.       end;
  581.     asm
  582.       les di,P
  583.       mov dl,es:[di].PortRec.PortName
  584.       xor dh,dh
  585.       mov ah,$08
  586.       int $14
  587.       cmp ah,$FF
  588.       je GotError
  589.       les di,C
  590.       mov byte ptr es:[di],al
  591.     end;
  592.     AsyncStatus := ecOk;
  593.     Exit;
  594.   GotError:
  595.     C := #$FF;
  596.     dGotError(P, epNonFatal+ecBufferIsEmpty);
  597.   end;
  598.  
  599.  
  600.   procedure dPutChar(P : PortRecPtr; C : Char);
  601.   label
  602.     GotError;
  603.  
  604.   begin
  605.     asm
  606.       les di,P
  607.       mov dl,es:[di].PortRec.PortName
  608.       xor dh,dh
  609.       mov ah,$01
  610.       mov al,C
  611.       int $14
  612.       cmp ah,$80
  613.       je GotError
  614.       les di,P
  615.       mov es:[di].PortRec.LineStatus,ah
  616.     end;
  617.     AsyncStatus := ecOk;
  618.     {$IFDEF Tracing}
  619.     if TracingOn then
  620.       AddTraceEntry('T', C);
  621.     {$ENDIF}
  622.     Exit;
  623.   GotError:
  624.     dGotError(P, epNonFatal+ecBufferIsFull);
  625.   end;
  626.  
  627.  
  628.   procedure dStartTransmitter(P : PortRecPtr);
  629.   begin
  630.   end;
  631.  
  632.  
  633.   function dCharReady(P : PortRecPtr) : Boolean;
  634.   begin
  635.     dCharReady := CharReadyPtr^ = $FF;
  636.   end;
  637.  
  638.  
  639.   function dTransReady(P : PortRecPtr) : Boolean; assembler;
  640.   asm
  641.     les di,P
  642.     mov dl,es:[di].PortRec.PortName
  643.     xor dh,dh
  644.     mov ah,$12
  645.     int $14
  646.     cmp ax,0
  647.     je @1
  648.     mov al,1
  649.   @1:
  650.   end;
  651.  
  652.  
  653.   procedure dSendBreak(P : PortRecPtr); assembler;
  654.   asm
  655.     mov AsyncStatus,ecOk
  656.     les di,P
  657.     mov dl,es:[di].PortRec.PortName
  658.     xor dh,dh
  659.     mov ah,$07
  660.     mov al,$00
  661.     int $14
  662.     cmp ah,0
  663.     je @1
  664.     mov AsyncStatus,ecCCBTimeOut
  665.   @1:
  666.   end;
  667.  
  668.  
  669.   function dGetLineStatusDirect(P : PortRecPtr) : Byte; assembler;
  670.   asm
  671.     mov AsyncStatus,ecOk
  672.     les di,P
  673.     mov dl,es:[di].PortRec.PortName
  674.     xor dh,dh
  675.     mov ah,$03
  676.     int $14
  677.     les di,P
  678.     mov es:[di].PortRec.LineStatus,ah
  679.     mov al,ah
  680.   end;
  681.  
  682.  
  683.   procedure dActivatePort(P : PortRecPtr; Restore : Boolean);
  684.   begin
  685.     dGotError(P, epNonFatal+ecNotSupported);
  686.   end;
  687.  
  688.  
  689.   procedure dDeactivatePort(P : PortRecPtr; Restore : Boolean);
  690.   begin
  691.     dGotError(P, epNonFatal+ecNotSupported);
  692.   end;
  693.  
  694.  
  695.   procedure dSavePort(P : PortRecPtr; var PSR);
  696.   begin
  697.     dGotError(P, epNonFatal+ecNotSupported);
  698.   end;
  699.  
  700.  
  701.   procedure dRestorePort(P : PortRecPtr; var PSR);
  702.   begin
  703.     dGotError(P, epNonFatal+ecNotSupported);
  704.   end;
  705.  
  706.  
  707.   procedure dGotError(P : PortRecPtr; StatusCode : Word);
  708.   begin
  709.     AsyncStatus := StatusCode;
  710.     with P^ do
  711.       begin
  712.         if @ErrorProc <> @NoErrorProc then
  713.           ErrorProc(ErrorData, StatusCode);
  714.         if ProtocolActive then
  715.           AsyncStatus := AsyncStatus mod 10000;
  716.       end;
  717.   end;
  718.  
  719.  
  720.   procedure ActivateApDigi;
  721.   begin
  722.     {$IFNDEF UseOOP}
  723.     InitPort := dInitPort;
  724.     InitPortKeep := dInitPortKeep;
  725.     DonePort := fDonePort;
  726.     SetLine := dSetLine;
  727.     GetLine := dGetLine;
  728.     SetModem := dSetModem;
  729.     GetModem := dGetModem;
  730.     GetChar := dGetChar;
  731.     PeekChar := dPeekChar;
  732.     PutChar := dPutChar;
  733.     StartTransmitter := dStartTransmitter;
  734.     CharReady := dCharReady;
  735.     TransReady := dTransReady;
  736.     SendBreak := dSendBreak;
  737.     ActivatePort := dActivatePort;
  738.     DeactivatePort := dDeactivatePort;
  739.     SavePort := dSavePort;
  740.     RestorePort := dRestorePort;
  741.     GotError := dGotError;
  742.     {$ENDIF}
  743.     SetUart := dSetUart;
  744.   end;
  745.  
  746.  
  747. begin
  748.   {$IFDEF AutoDeviceInit}
  749.   ActivateApUart;
  750.   {$ELSE}
  751.   SetUart := dSetUart;
  752.   {$ENDIF}
  753.  
  754.   AnsiOutput := dPutChar;
  755. end.
  756.